/*
 *  mainwindow.h
 *  Perceel
 *
 *  Created by Nicola Gigante on 15/03/08.
 *  Copyright 2008 Nicola Gigante. All rights reserved.
 *
 */

#ifndef __MAINWINDOW_H__
#define __MAINWINDOW_H__

#include <QMainWindow>
#include <QMessageBox>
#include <QFileDialog>
#include <QPrintDialog>
#include <QPrintPreviewDialog>
#include <QPrinter>
#include <QUrl>
#include <QDrag>
#include <QMimeData>
#include <QProcess>
#include <QImageWriter>
#include <QDesktopServices>
#include <QSettings>
#include "ui_mainwindow.h"

#include "polynomial.h"
#include "tf.h"
#include "tf_listmanager.h"
#include "tf_renderer.h"
#include "tf_listdelegate.h"
#include "tf_dialog.h"
#include "prefdialog.h"

#define PERCEEL_VERSION "0.6"

class MainWindow : public QMainWindow, Ui::MainWindow
{
	Q_OBJECT
	
	TFListManager *manager;
	TFListDelegate *delegate;
	
	struct
	{
		QStringList recentList;
		bool openAfterExporting;
		int recentsCount;
	} settings;
	
public:
	MainWindow();
	
protected:
	void closeEvent(QCloseEvent *event);
	bool event(QEvent *event);
	bool eventFilter(QObject *, QEvent *event);
	
public slots:
	void newFunction();
	void closeFunction();
	void changeTF(const QModelIndex &selection);
	void updateWindowTitle();
	bool save();
	QMessageBox::StandardButton close();
	bool open(QString filename = QString());
	bool exportImage();
	bool print(QPrinter *printer = NULL);
	void printPreview();
	void modeChanged(QAction *action);
	void showPref();
	void about();
	void showHelp();
	void showLicense();
	
private slots:
	void openProxyMenu(QAction *action);
	void openRecentFile();
	void clearRecents();
	
private:
	void readSettings();
	void storeSettings();
	void addToRecentList(QString filename);
};

#endif
